package cn.tedu.sp02.service;

import cn.tedu.sp01.pojo.Item;
import cn.tedu.sp01.service.ItemService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
@Slf4j
@Service
public class ItemServiceImpl implements ItemService {

    public List<Item> getItems(String orderId) {
        log.info("获取商品列表,orderId="+orderId );
        ArrayList<Item> items = new ArrayList<Item>();
        items.add(new Item(1, "product1", 1));
        items.add(new Item(2, "product2", 2));
        items.add(new Item(3, "product3", 3));
        items.add(new Item(4, "product4", 4));
        items.add(new Item(5, "product5", 5));
        items.add(new Item(6, "product6", 6));

        return items;
    }

    public void decreaseNumbers(List<Item> items) {
        for(Item item : items){
            log.info("商品数量--"+item);
        }
    }
}
